<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * array_val
 *
 * Get the first not null value from the argument list
 *
 * @access	public
 * @param	mixed
 * @return	mixed
 */
if ( ! function_exists('array_val')) {
	function array_val() {
		$args = func_get_args();
		foreach($args as $arg)
			if ($arg) return $arg;
		return null;
	}
	
	function truncate($s, $len=50) {
		
		return (strlen($s) > $len) ? preg_replace('/\s+?(\S+)?$/', '', substr($s, 0, $len)).'...' : $s;
	}
}
